package org.dh2580.spring.batch.demo.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.dh2580.spring.batch.demo.dao.data.Test;

/**
 * @Author: hao.deng
 * @Date: 2019/5/9-下午2:50
 */
public interface TestDao {

    @Select("SELECT id,name FROM tb_test WHERE age = #{age} AND is_deleted = 0")
    @Results(
            id = "simpleTest",
            value = {
                    @Result(column = "id", property = "id"),
                    @Result(column = "name", property = "name")
            }
    )
    List<Test> selectByAge(@Param("age") Integer age);

    @Select("SELECT id,name FROM tb_test WHERE address = #{address} AND is_deleted = 0")
    @ResultMap("simpleTest")
    List<Test> selectByAddress(@Param("address") String address);
}
